package com.yanqu.road.server.cmd.activity.apprentice.cross;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ApprenticeProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.apprentice.ApprenticeModule;
import com.yanqu.road.server.manger.activity.apprentice.ApprenticeMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_APPRENTICE_USER_TALENT_CHANGE_FROM_CROSS,desc = "爱徒养成--跨服返回-同步玩家天赋数据变更")
public class ApprenticeChangeTalentFromCrossCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ApprenticeProto.ApprenticeSyncUserTalentChangeCrossMsg respMsg = ApprenticeProto.ApprenticeSyncUserTalentChangeCrossMsg.parseFrom(packet.getBytes());
        //跨服返回-同步玩家天赋数据变更-异步处理
        ApprenticeMgr.changeUserTalentFromCross(
                respMsg.getActivityId(),
                packet.getPlayerId(),
                respMsg.getTalentData().getTalentType(),
                respMsg.getTalentData().getTalentValue(),
                respMsg.getAllTalent()
        );
    }

    @Override
    public void sendData(GamePlayer player) {}
}
